package com.aps.web.controller.business_department;

import java.math.BigDecimal;
import java.util.List;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.aps.common.annotation.Log;
import com.aps.common.core.controller.BaseController;
import com.aps.common.core.domain.AjaxResult;
import com.aps.common.enums.BusinessType;
import com.aps.system.domain.VexpContractFztz;
import com.aps.system.service.IVexpContractFztzService;
import com.aps.common.utils.poi.ExcelUtil;
import com.aps.common.core.page.TableDataInfo;

/**
 * 服装鞋部合同台账Controller
 *
 * @author 陈炎兴
 * @date 2024-07-15
 */
@RestController
@RequestMapping("/system/fztz")
public class VexpContractFztzController extends BaseController {
    @Autowired
    private IVexpContractFztzService vexpContractFztzService;

    /**
     * 查询服装鞋部合同台账列表
     */
    @PreAuthorize("@ss.hasPermi('system:fztz:list')")
    @GetMapping("/list")
    public TableDataInfo list(VexpContractFztz vexpContractFztz) {
        startPage();
        List<VexpContractFztz> list = vexpContractFztzService.selectVexpContractFztzList(vexpContractFztz);
        return getDataTable(list);
    }

    /**
     * 导出服装鞋部合同台账列表
     */
    @PreAuthorize("@ss.hasPermi('system:fztz:export')")
    @Log(title = "服装鞋部合同台账" , businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, VexpContractFztz vexpContractFztz) {
        List<VexpContractFztz> list = vexpContractFztzService.selectVexpContractFztzList(vexpContractFztz);
        ExcelUtil<VexpContractFztz> util = new ExcelUtil<VexpContractFztz>(VexpContractFztz.class);
        util.exportExcel(response, list, "服装鞋部合同台账数据");
    }

    /**
     * 获取服装鞋部合同台账详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:fztz:query')")
    @GetMapping(value = "/{Price}")
    public AjaxResult getInfo(@PathVariable("Price") BigDecimal Price) {
        return success(vexpContractFztzService.selectVexpContractFztzByPrice(Price));
    }

    /**
     * 新增服装鞋部合同台账
     */
    @PreAuthorize("@ss.hasPermi('system:fztz:add')")
    @Log(title = "服装鞋部合同台账" , businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody VexpContractFztz vexpContractFztz) {
        return toAjax(vexpContractFztzService.insertVexpContractFztz(vexpContractFztz));
    }

    /**
     * 修改服装鞋部合同台账
     */
    @PreAuthorize("@ss.hasPermi('system:fztz:edit')")
    @Log(title = "服装鞋部合同台账" , businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody VexpContractFztz vexpContractFztz) {
        return toAjax(vexpContractFztzService.updateVexpContractFztz(vexpContractFztz));
    }

    /**
     * 删除服装鞋部合同台账
     */
    @PreAuthorize("@ss.hasPermi('system:fztz:remove')")
    @Log(title = "服装鞋部合同台账" , businessType = BusinessType.DELETE)
    @DeleteMapping("/{Prices}")
    public AjaxResult remove(@PathVariable BigDecimal[] Prices) {
        return toAjax(vexpContractFztzService.deleteVexpContractFztzByPrices(Prices));
    }

    @GetMapping("/getMoney")
    public AjaxResult getMoney(){
        return success(null);
    }
}
